package com.lnsf.bookstore.system.chapter.service.impl;

import com.github.pagehelper.PageInfo;
import com.lnsf.bookstore.system.chapter.service.ChapterService;
import com.lnsf.bookstore.system.chapter.dao.ChapterMapper;
import com.lnsf.bookstore.system.chapter.vo.Chapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class ChapterServiceImpl implements ChapterService {

    @Autowired
    private ChapterMapper chapterMapper;


    @Override
    public int save(Chapter chapter) {
        return chapterMapper.insertSelective(chapter);
    }

    @Override
    public Chapter queryObject(Integer id) {
        return chapterMapper.queryObject(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        return chapterMapper.deleteBatch(ids);
    }

    @Override
    public int update(Chapter chapter) {
        return chapterMapper.updateByPrimaryKeySelective(chapter);
    }

    @Override
    public PageInfo<Chapter> queryList(Map<String, Object> params) {
        return new PageInfo<Chapter>(chapterMapper.queryList(params));
    }
}
